package com.itheima.service.impl;

import java.util.List;

import javax.annotation.Resource;
import javax.persistence.metamodel.Type.PersistenceType;

import org.hibernate.criterion.DetachedCriteria;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;

import com.itheima.dao.ICustomerDao;
import com.itheima.domain.Customer;
import com.itheima.service.ICustomerService;

@Service("customerService")
@Transactional(readOnly=true,propagation=Propagation.SUPPORTS)
public class ICustomerServiceImpl implements ICustomerService{
	@Resource(name="customerDao")
	private ICustomerDao customerDao;
	@Override
	public List<Customer> findAllCustomer(DetachedCriteria dCriteria) {
		// TODO Auto-generated method stub
		return customerDao.findAll(dCriteria);
	}

	@Override
	@Transactional(readOnly=false,propagation=Propagation.REQUIRED)
	public void saveCustomer(Customer customer) {
		// TODO Auto-generated method stub
		customerDao.save(customer);
	}
	
	



}
